var tuiwa = require("../../tuiwa.js")
Page({
  data: {
    bg: "",
    desc: "",
    textareaContent: "",
    placeholderTitle: "请输入你想写的话"
  },
  onLoad: function (options) {
    console.log(options)
    this.setData({
      bg: options.bg
    })
  },
  onShow: function () {

  },

  backClick() {
    tt.navigateBack();
  },
  textareaValue(e) {
    this.setData({
      textareaContent: e.detail.value
    })
  },
  makeDrawingClick() {
    if (this.data.textareaContent == '') {
      tt.showToast({
        title: '请输入你想写的话',
        icon: "none",
        duration: 1500
      });
      return
    }
    tt.request({
      url: 'https://vs.tuiwa.com/dy_mini/check_content',
      method: "post",
      header: {
        "content-type": "application/json"
      },
      data: {
        appId: tuiwa.globalData.appId,
        content: this.data.textareaContent
      },
      success: (res) => {
        if (!res.data.data) {
          var bg = this.data.bg
          var textareaContent = this.data.textareaContent
          tt.navigateTo({
            url: `/pages/newYearFlag-three/newYearFlag-three?bg=${bg}&textareaContent=${textareaContent}`
          });
        } else {
          tt.showToast({
            title: "敏感词请重新输入！",
            icon: "none"
          });
          return
        }
      }
    });
  }
});